#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableWarChessChapterDao:DaoBase<TableWarChessChapter>
    {
        public override string GetFileName()
        {
            return "TableWarChessChapter.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableWarChessChapter>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableWarChessChapter model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.chapterId)) UnityEngine.Debug.LogError("数据表id重复:TableWarChessChapter->id: " + model.chapterId);
            #endif
            cachePrimaryInt[model.chapterId] = model;
        }
        protected override TableWarChessChapter ParseRowData(string[] rowData)
        {
            TableWarChessChapter data = new TableWarChessChapter();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.chapterId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.orderNum = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.chapterName = rowData[2];
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.chapterDesc = rowData[3];
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.mapId = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.chapterBackground = rowData[5];
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.mapLenth = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.mapWidth = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.firstPlay = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.maxRound = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.gridWidth = float.Parse(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.gridHeight = float.Parse(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.beginPos = rowData[12];
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.groupId = int.Parse(rowData[13]);
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.isTrainChapter = int.Parse(rowData[14]);
            }
            if (!string.IsNullOrEmpty(rowData[15]))
            {
                data.reward = rowData[15];
            }
            if (!string.IsNullOrEmpty(rowData[16]))
            {
                data.recommendedLevel = int.Parse(rowData[16]);
            }
            if (!string.IsNullOrEmpty(rowData[17]))
            {
                data.gridOrder = int.Parse(rowData[17]);
            }
            if (!string.IsNullOrEmpty(rowData[18]))
            {
                data.anchoredPosition = rowData[18];
            }
            if (!string.IsNullOrEmpty(rowData[19]))
            {
                data.recomandHero = rowData[19];
            }
            if (!string.IsNullOrEmpty(rowData[20]))
            {
                data.enemyIcon = rowData[20];
            }
            return data;
        }
    }
}
